package com.sky.controller.user;

import com.sky.result.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController("userShopController")
@RequiredArgsConstructor
@RequestMapping("/user/shop")
public class ShopController {

    private final RedisTemplate redisTemplate;

    //获取营业状态
    @GetMapping("/status")
    public Result<Integer> getShopStatus() {
        Integer status = (Integer) redisTemplate.opsForValue().get("Shop_Status");
        log.info("获取营业状态:{}", status == 1 ? "营业中" : "打烊");
        return Result.success(status);
    }
}
